<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery.min.js"></script>

<script type="text/javascript" src="ddaccordion.js"></script>
<script type="text/javascript">

//Initialize Arrow Side Menu:
ddaccordion.init({
	headerclass: "menuheaders", //Shared CSS class name of headers group
	contentclass: "menucontents", //Shared CSS class name of contents group
	revealtype: "clickgo", //Reveal content when user clicks or onmouseover the header? Valid value: "click", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["unselected", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: 500, //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

</script>
<style type="text/css">

.arrowsidemenu{
	width: 100%; /*width of menu*/
	border-style: solid solid none solid;
	border-color: #94AA74;
	border-size: 1px;
	border-width: 1px;
}
 div.pub{
	background: transparent url(images/gs4.fw.png) 100% 0;
	height:40px;
	width:100%;
	text-align:center;
	vertical-align:central;
	font-weight:bold;
	color:#036;
}
div.pub:hover{
	background: transparent url(images/gs42.fw.png) 100% 0;
	height:40px;
	width:100%;
	text-align:center;
	vertical-align:central;
}
	
.arrowsidemenu div a{ /*header bar links*/
	font: bold 12px Verdana, Arial, Helvetica, sans-serif;
	display: block;
	background: transparent url(images/arrowgreen.gif) 100% 0;
  height: 24px; /*Set to height of bg image-padding within link (ie: 32px - 4px - 4px)*/
	padding: 4px 0 4px 10px;
	line-height: 24px; /*Set line-height of bg image-padding within link (ie: 32px - 4px - 4px)*/
	text-decoration: none;
	
}
	
.arrowsidemenu div a:link, .arrowsidemenu div a:visited{
	color: #26370A;
}

.arrowsidemenu div a:hover{
	background-position: 100% -32px;
}

.arrowsidemenu div.unselected a{ /*header that's currently not selected*/
	color: #6F3700;
}

	
.arrowsidemenu div.selected a{ /*header that's currently selected*/
	color: blue;
	background-position: 100% -64px !important;
}

.arrowsidemenu ul{
	list-style-type: none;
	margin: 0;
	padding: 0;
}

.arrowsidemenu ul li{
	border-bottom: 1px solid #a1c67b;
}


.arrowsidemenu ul li a{ /*sub menu links*/
	display: block;
	font: normal 12px Verdana, Arial, Helvetica, sans-serif;
	text-decoration: none;
	color: black;
	padding: 5px 0;
	padding-left: 10px;
	border-left: 10px double #a1c67b;
	width:100%;
}

.arrowsidemenu ul li a:hover{
	background: #d5e5c1;
}

</style>
<style type=text/css>
table {
	align: center;
	
}
table.imagetable {

	font-family: verdana,arial,sans-serif;
	font-size:14px;
	color:#333333;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
	
}
table.imagetable th {
	background:#b5cfd2 url(cell-blue.jpg);
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
table.imagetable td {
	background:#dcddc0 url(cell-grey.jpg);
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
</style>
</head>

<body>
<div style="position: absolute; left: 585px; top: 32px;"><?php
$curryr = date("Y");
$month = array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$lastyr=$curryr-1;
$dis="<form action=s4yrrep.php method=post ><select name=mnth>";
for($i=0; $i<12; $i++){
	$k=$i+1;
	if($k==9){
	$dis.="<option value=$k selected=selected>$month[$i]</optgroup>";	
	}else{
	$dis.="<option value=$k>$month[$i]</optgroup>";
	}
}
$dis.="</select><select name=yr>";
for($i=2000; $i<3000; $i++){
	if($i==$lastyr)
	{
	$dis.="<option value=$i selected=selected>$i</option>";	
	}else{
	$dis.="<option value=$i>$i</option>";	
	}
}
$dis.="</select><input type=text name=grp placeholder=\"Enter Group No.\" required=required /><input type=submit name=search value=\"Display Annual Report\" class=yrs4 /></form>";
print("$dis");
//exit;
?></div>

<div style="position: absolute; top: 101px; left: 92px; width: 982px;" align="center"  >
<div class="arrowsidemenu">
<?php
include("conn.php");
if(isset($_POST['search'])){
	$grp=$_POST['grp'];
	$mn=$_POST['mnth'];
	$yr=$_POST['yr'];
	$mn2=$mn+1;
	$imn=$mn-1;
	if($mn2>12){
		$mn2=1;
	}
	$sdat="$yr-$mn2-01";
	//print("$yr<br>");
	$bk=0;
	$bklets=0;
	$curryr = date("Y");
	
	$cmnth =date("m");
	//print("$cmnth $curryr<br><br>");
	$hrs=0;
	$magz=0;
	$rv=0;
	$bs=0;
	$dp="";
	$month = array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$s="select * from publishers where state=1 and pubgrpnum='$grp' order by lname, fname desc";
$r=mysql_query($s,$conn) or die(mysql_error());
$dp="<h3 align=left> Group $grp Annual Report Starting $month[$imn] $yr</h3>";
while($tt=mysql_fetch_array($r)){
	$id=$tt['pubid'];
	$ss="select * from s4 where indate >= '$sdat' and yr>='$yr' and pubid='$id'";
	$rr=mysql_query($ss,$conn) or die(mysql_error());
	$bk=0;
	$bklets=0;
	$hrs=0;
	$magz=0;
	$rv=0;
	$bs=0;
	
	$dp.="
	<div class=menuheaders><div align=left class=pub>Annual S4 Report For $tt[fname]  $tt[lname]</div></div>
	<ul class=menucontents>
	<li><table cellpadding=3 cellspacing=1 class=imagetable width=100%><tr>
	<th></th>
	<th>Books</th>
	<th>Booklets</th>
	<th>Hrs</th>
	<th>Magazines</th>
	<th>Return Visists</th>
	<th>Bible Studies</th>
	<th align=left>Comments</th>
	</tr>
	";
	while($t=mysql_fetch_array($rr)){
	$pt=$t['Month'];
	$yrr=$t['yr'];
	$pt2=$pt-1;
	//print("im getting here $pt $tt[fname]<br> ");
	if(($pt>=$mn and $yrr=$yr) or ($pt<$cmnth and $yrr=$curryr)){
	$dp.="<tr>
	<td align=right>$month[$pt2] $t[yr]</td>
	<td align=center>$t[bks]</td>
	<td align=center>$t[bklets]</td>
	<td align=center>$t[hrs]</td>
	<td align=center>$t[magz]</td>
	<td align=center>$t[rvisits]</td>
	<td align=center>$t[bstudy]</td>
	<td align=left>$t[comments]</td>
	</tr>";
	$bk+=$t['bks'];
	$bklets+=$t['bklets'];
	$hrs+=$t['hrs'];
	$magz+=$t['magz'];
	$rv+=$t['rvisits'];
	$bs+=$t['bstudy'];
		}
	}
		$dp.="<tr>
		<td align=right><strong>Total Annual Report</strong></td>
		<td align=center><strong>$bk</strong></td>
		<td align=center><strong>$bklets</strong></td>
		<td align=center><strong>$hrs</strong></td>
		<td align=center><strong>$magz</strong></td>
		<td align=center><strong>$rv</strong></td>
		<td align=center><strong>$bs</strong></td>
		<td></td>
		</tr></table></li></ul>";
	}
	$dp.="</div><br><br>";
	print("$dp");
}
?></div></div>
</body>
</html>